class Solution:
    def isPowerOfFour(self, n: int) -> bool:
      if n <= 0:
        return False
      while n > 1:
        n /= 4
      if n != 1:
        return False
      return True


#
class Solution:
    def isPowerOfFour(self, n: int) -> bool:
        return n > 0 and (n & (n - 1)) == 0 and n % 3 == 1